package com.atguigu.validator.two;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class testUser {
    @Test
    public void testOne() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(ValidationConfig.class);
        MyValidation1 bean = context.getBean(MyValidation1.class);
        User user = new User();
        user.setName("ee");
        boolean message = bean.validateByUser(user);
        System.out.println( message);
    }

    @Test
    public void testTwo() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(ValidationConfig.class);
        MyValidation2 bean = context.getBean(MyValidation2.class);
        User user = new User();
        user.setName("ee");
        user.setAge(200);
        boolean message = bean.validateUser2(user);
        System.out.println( message);
    }
}
